stringlist: Call splice() for adding items after construction
authorBenjamin Otte <otte@redhat.com>
Tue, 30 Jun 2020 21:31:02 +0000 (23:31 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 5 Jul 2020 00:59:21 +0000 (02:59 +0200)
This has the benefit of actually allowing NULL to be passed.

gtk/gtkstringlist.c

index a3e2af5f68c4cebbb25043bff4ef17eef89ada5d..608081d5002452066564d15a2fe69513032a03b8 100644 (file)
@@ -434,12 +434,10 @@ GtkStringList *
 gtk_string_list_new (const char * const *strings)
 {
   GtkStringList *self;
-  guint i;
 
   self = g_object_new (GTK_TYPE_STRING_LIST, NULL);
 
-  for (i = 0; strings[i]; i++)
-    g_sequence_append (self->items, gtk_string_object_new (strings[i]));
+  gtk_string_list_splice (self, 0, 0, strings);
 
   return self;
 }